package com.eclink.asset.asset.controller;


import com.eclink.asset.asset.domain.dto.DataReportAssetCategoryDTO;
import com.eclink.asset.asset.service.AssetDataReportCategoryService;

import com.eclink.asset.pojo.vo.AssetCategoryVO;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 资产数据报表接口 - 分类
 *
 * @author chenshixian
 * @date 2024-09-10
 */
@Api(tags ="资产数据报表接口 - 分类")
@RestController
@RequestMapping("/asset/dataReport/category")
public class AssetDataReportCategoryController extends BaseController {

    @Resource
    private AssetDataReportCategoryService assetDataReportCategoryService;

    @ApiOperation("列表")
    @PostMapping("/list")
    public ResponseEntity<List<DataReportAssetCategoryDTO>> list() {
        return ResponseEntity.ok(assetDataReportCategoryService.list());
    }

    @ApiOperation("导出")
    @GetMapping("/export")
    public ResponseEntity<String> export() {
        List<DataReportAssetCategoryDTO> list = assetDataReportCategoryService.list();
        ExcelUtil<DataReportAssetCategoryDTO> util = new ExcelUtil<>(DataReportAssetCategoryDTO.class);
        return ResponseEntity.ok(util.writeExcel(list, "资产分类数据报表"));
    }

}
